<template>
  <div class="base-form">
    <form action="">
      <p>
        <input type="text" v-model="username" />
      </p>
      <p>
        <input type="password" v-model="password" />
      </p>

      <button @click="getForm">获取数据</button>
      <button @click="resetForm">重置表单</button>
    </form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: "",
      password: "",
    };
  },
  methods: {
    getForm() {
      console.log({
        username: this.username,
        password: this.password,
      })
      
      return {
        username: this.username,
        password: this.password,
      };
    },
    resetForm() {
      this.username = "";
      this.password = "";
    },
  },
};
</script>

<style>
.base-form {
  padding: 30px;
  width: 300px;
  height: 250px;
  border: 1px solid black;
  border-radius: 5%;
  margin: 0 auto;
}
</style>